home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Kleartxt UAM.h
-
- Contains: Sample UAM that uses a cleartext password
-
- Copyright: © 1998 by Apple Computer, Inc., all rights reserved.
- */
-
-
- #include <types.h>
- #include <CodeFragments.h>
- #include <string.h>
- #include "UAM.h"
- #include "OAMTypes.h"
-
-
- #pragma export on
-
- unsigned long UAMVersion = 0;
- unsigned long UAMFlags = 0;
- unsigned char *UAMName = "\pKleartxt Passwrd";
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- OAMStatus UAMAuthenticate(SInt32 operation, SInt32 id,
- void* authState, SInt32 authStateSize, void* authData, SInt32 authDataSize,
- void* authStateOut, SInt32* authStateSizeOut, void* authDataOut, SInt32* authDataSizeOut)
- {
- int status = kOAMErrAuthenticationError;
- unsigned char password[8];
- UInt32 size = 8;
- char *pwptr = (char *)authData;
-
- *authStateSizeOut = 0;
- *authDataSizeOut = 0;
-
- switch (operation) {
- case kUAMAuthLogin: // for login
- DebugStr("\pIn UAMAuthenticate operation = kUAMAuthLogin");
- // skip the username
- pwptr += (unsigned char)*pwptr + 1; // the username is a pascal string
-
- UAMGetAttributeID(id, kUser, kPasswordAttribute, password, &size);
- if (memcmp(pwptr, password, 8) == 0)
- {
- status = 0;
- }
-
- break;
- case kUAMAuthLoginContinue: // for login
- DebugStr("\pIn UAMAuthenticate operation = kUAMAuthLoginContinue");
- break;
- case kUAMAuthChangeKey: // for change password
- DebugStr("\pIn UAMAuthenticate operation = kUAMAuthChangeKey");
- break;
- case kUAMAuthChangeKeyContinue: // for change password
- DebugStr("\pIn UAMAuthenticate operation = kUAMAuthChangeKeyContinue");
- break;
-
- }
- return status;
- }
-
- pascal OSErr UAMSetUP(const CFragInitBlock *theInitBlock){
-
- // put one time initalization stuff here (called when agent loads the UAM at boot)
- DebugStr("\pIn the Setup routine");
- return noErr;
- }
-
-
- pascal void UAMCleanUP(void){
- // put cleanup stuff here (called when agent unloads the UAM at shutdown)
- DebugStr("\pIn the Shutdown routine");
- }
-
- #ifdef __cplusplus
- }
- #endif
-
-
-
-